
import 'osc_about_entity.dart';
import 'osc_author.dart';
import 'osc_statistics.dart';

class OscNewsDetail {
	int newsId;
	OscNewsDetailSoftware software;
	OscAuthor author;
	List<OscAbout> abouts;
	String href;
	int id;
	String body;
	String title;
	int type;
	bool favorite;
	String pubDate;
	OscStatistics statistics;

	OscNewsDetail({this.newsId, this.software, this.author, this.abouts, this.href, this.id, this.body, this.title, this.type, this.favorite, this.pubDate, this.statistics});

	OscNewsDetail.fromJson(Map<String, dynamic> json) {
		newsId = json['newsId'];
		software = json['software'] != null ? new OscNewsDetailSoftware.fromJson(json['software']) : null;
		author = json['author'] != null ? new OscAuthor.fromJson(json['author']) : null;
		if (json['abouts'] != null) {
			abouts = new List<OscAbout>();(json['abouts'] as List).forEach((v) { abouts.add(new OscAbout.fromJson(v)); });
		}
		href = json['href'];
		id = json['id'];
		body = json['body'];
		title = json['title'];
		type = json['type'];
		favorite = json['favorite'];
		pubDate = json['pubDate'];
		statistics = json['statistics'] != null ? new OscStatistics.fromJson(json['statistics']) : null;
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['newsId'] = this.newsId;
		if (this.software != null) {
      data['software'] = this.software.toJson();
    }
		if (this.author != null) {
      data['author'] = this.author.toJson();
    }
		if (this.abouts != null) {
      data['abouts'] =  this.abouts.map((v) => v.toJson()).toList();
    }
		data['href'] = this.href;
		data['id'] = this.id;
		data['body'] = this.body;
		data['title'] = this.title;
		data['type'] = this.type;
		data['favorite'] = this.favorite;
		data['pubDate'] = this.pubDate;
		if (this.statistics != null) {
      data['statistics'] = this.statistics.toJson();
    }
		return data;
	}
}

class OscNewsDetailSoftware {
	String name;
	String href;
	int id;

	OscNewsDetailSoftware({this.name, this.href, this.id});

	OscNewsDetailSoftware.fromJson(Map<String, dynamic> json) {
		name = json['name'];
		href = json['href'];
		id = json['id'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['name'] = this.name;
		data['href'] = this.href;
		data['id'] = this.id;
		return data;
	}
}
